﻿Imports Microsoft.VisualBasic

Public Class CSession : Inherits CSessionBase


    Public Shared Property SelectedSeries() As CSeriesList
        Get
            Dim key As String = String.Concat("SelectedSeries: ", CUtilities.ListToString(SelectedSeriesIds))

            Dim list As CSeriesList = [Get](key)
            If Not IsNothing(list) Then Return list

            Dim temp As New CSeriesList
            For Each i As CSeries In CSeries.Cache
                If CSession.SelectedSeriesIds.Contains(i.SeriesId) Then temp.Add(i)
            Next
            [Set](key, temp)
            Return temp
        End Get
        Set(ByVal value As CSeriesList)
            Dim key As String = String.Concat("SelectedSeries: ", CUtilities.ListToString(SelectedSeriesIds))
            [Set](key, value)
        End Set
    End Property
    Public Shared ReadOnly Property SelectedSeriesIds() As List(Of Integer)
        Get
            Dim list As List(Of Integer) = [Get]("SelectedSeriesIds")
            If IsNothing(list) Then
                list = New List(Of Integer)(CSeries.Cache.Ids)
                [Set]("SelectedSeriesIds", list)
            End If
            If list.Count = 0 Then
                list = New List(Of Integer)(CSeries.Cache.Ids)
                [Set]("SelectedSeriesIds", list)
            End If
            Return list
        End Get
    End Property

End Class
